package com.jq.invoicing.test.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.springframework.security.GrantedAuthority;
import org.springframework.security.GrantedAuthorityImpl;
import org.springframework.security.userdetails.UserDetails;

public class Person implements UserDetails,Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1697398064338939085L;
	
	private String id;
	private String account;
	private String pwd;
	private String name;
	private String address;
	
	public String getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	public String getAddress() {
		return address;
	}
	public void setId(String id) {
		this.id = id;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getAccount() {
		return account;
	}
	public String getPwd() {
		return pwd;
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	
	public GrantedAuthority[] getAuthorities() {
		List<GrantedAuthority> list = new ArrayList<GrantedAuthority>();
        list.add(new GrantedAuthorityImpl("ROLE_USER"));
        return list.toArray(new GrantedAuthority[list.size()]);
	}
	public String getPassword() {
		// TODO Auto-generated method stub
		return pwd == null || "".equals(pwd)? "" : pwd.toLowerCase();
	}
	public String getUsername() {
		// TODO Auto-generated method stub
		return this.getName();
	}
	public boolean isAccountNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}
	public boolean isAccountNonLocked() {
		// TODO Auto-generated method stub
		return true;
	}
	public boolean isCredentialsNonExpired() {
		// TODO Auto-generated method stub
		return true;
	}
	public boolean isEnabled() {
		// TODO Auto-generated method stub
		return true;
	}
}
